﻿using System.Windows.Media.Imaging;
using EnvDTE;

namespace CodeJumper
{
    public class AccessibilityContainer
    {
        private readonly ApplicationConfiguration _appConfig;
        private readonly vsCMAccess _access;
        public Accessibility Accessibility = Accessibility.Public;
        public BitmapImage AccessibilityImage;
        public double Opacity;

        public AccessibilityContainer(ApplicationConfiguration appConfig, vsCMAccess access)
        {
            this._appConfig = appConfig;
            this._access = access;
        }

        public void Create()
        {
            switch (_access)
            {
                case vsCMAccess.vsCMAccessPrivate:
                    {
                        AccessibilityImage = _appConfig.GetImage("private");
                        Accessibility = Accessibility.Private;
                        Opacity = _appConfig.AccessiblityPrivate.Opacity;
                        break;
                    }
                case vsCMAccess.vsCMAccessProtected:
                    {
                        AccessibilityImage = _appConfig.GetImage("protected");
                        Accessibility = Accessibility.Protected;
                        Opacity = _appConfig.AccessiblityProtected.Opacity;
                        break;
                    }
                case vsCMAccess.vsCMAccessProject:
                    {
                        AccessibilityImage = _appConfig.GetImage("internal");
                        Accessibility = Accessibility.Internal;
                        Opacity = _appConfig.AccessiblityInternal.Opacity;
                        break;
                    }

                case vsCMAccess.vsCMAccessPublic:
                    {
                        AccessibilityImage = _appConfig.GetImage("public");
                        Accessibility = Accessibility.Public;
                        Opacity = _appConfig.AccessiblityPublic.Opacity;
                        break;
                    }
                case vsCMAccess.vsCMAccessProjectOrProtected:
                    {
                        AccessibilityImage = _appConfig.GetImage("protectedinternal");
                        Accessibility = Accessibility.ProtectedInternal;
                        Opacity = _appConfig.AccessiblityProtectedInternal.Opacity;
                        break;
                    }
            }
        }
    }
}